#ifndef _VN_SFML_CLOUD_SPAWNER_H_
#define _VN_SFML_CLOUD_SPAWNER_H_

#include "..\Graphics\Rect.h"
#include "..\Graphics\Sprite.h"
#include "..\Generic\GameTime.h"
#include "..\Generic\Random.h"
#include <list>
#include <vector>

class CloudSpawner
{
public:
	CloudSpawner(const vn::IntRect& p_spawnDimensions, float p_velocity, int p_minSpawnInterval, int p_maxSpawnInterval, unsigned int p_view, float p_layer);
	~CloudSpawner(void);

	void update(const GameTime& p_gameTime);
	void addSpriteID(const std::string& p_id) { m_spriteIDs.push_back(p_id); }		// adds sprite ID for creating clouds
	void spawnClouds(int p_amounts);												// will spawn p_amounts of clouds randomly inside the spawn dimension.

protected:
	inline void spawn();
	inline void generateTargetTime();

	std::vector<std::string> m_spriteIDs;
	std::list<vn::Sprite*> m_clouds;
	std::vector<vn::Sprite*> m_removeList;
	vn::IntRect m_spawnDimensions;
	int m_minSpawnInterval;
	int m_maxSpawnInterval;
	int m_targetTime;
	int m_elapsedTime;
	unsigned int m_view;
	float m_layer;
	float m_velocity;
};

#endif // _VN_SFML_CLOUD_SPAWNER_H_